// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) ansi lnc 

package com.example.airkissdemo.Util;

import java.util.Locale;

public class Util
{

    public Util()
    {
    }

    public static String byteArray2HexString(byte abyte0[], int i)
    {
        if(abyte0 != null && abyte0.length != 0) goto _L2; else goto _L1
_L1:
        String s = null;
_L4:
        return s;
_L2:
        int j;
        StringBuilder stringbuilder;
        int k;
        j = i;
        if(abyte0.length < i)
            j = abyte0.length;
        stringbuilder = new StringBuilder();
        k = 0;
_L5:
label0:
        {
            if(k < j)
                break label0;
            s = stringbuilder.toString().toUpperCase(Locale.US);
        }
        if(true) goto _L4; else goto _L3
_L3:
        String s1;
        int l;
        int i1;
        s1 = Integer.toHexString(0xff & abyte0[k]);
        l = 2 - s1.length();
        i1 = 0;
_L6:
label1:
        {
            if(i1 < l)
                break label1;
            stringbuilder.append(s1);
            if(k != j - 1)
                stringbuilder.append(" ");
            k++;
        }
          goto _L5
        stringbuilder.append("0");
        i1++;
          goto _L6
    }

    private static byte crc8_byte(byte byte0)
    {
        short word0 = 0;
        short word1 = (short)(byte0 & 0xff);
        int i = 0;
        do
        {
            if(i >= 8)
                return (byte)(word0 & 0xff);
            if((1 & (word0 ^ word1)) != 0)
                word0 = 0x80 | (short)(word0 ^ 0x18) >> 1;
            else
                word0 >>= 1;
            word1 >>= 1;
            i++;
        } while(true);
    }

    public static byte crc8_bytes(byte abyte0[], int i)
    {
        byte byte0 = 0;
        int j = 0;
        do
        {
            if(j >= i)
                return byte0;
            byte0 = crc8_byte(byte0 ^ abyte0[j]);
            j++;
        } while(true);
    }

    public static String shortArray2HexString(int ai[], int i)
    {
        if(ai != null && ai.length != 0) goto _L2; else goto _L1
_L1:
        String s = null;
_L4:
        return s;
_L2:
        int j;
        StringBuilder stringbuilder;
        int k;
        j = i;
        if(ai.length < i)
            j = ai.length;
        stringbuilder = new StringBuilder();
        k = 0;
_L5:
label0:
        {
            if(k < j)
                break label0;
            s = stringbuilder.toString().toUpperCase(Locale.US);
        }
        if(true) goto _L4; else goto _L3
_L3:
        String s1;
        int l;
        int i1;
        s1 = Integer.toHexString(ai[k]);
        l = 4 - s1.length();
        i1 = 0;
_L6:
label1:
        {
            if(i1 < l)
                break label1;
            stringbuilder.append(s1);
            if(k != j - 1)
                stringbuilder.append(" ");
            k++;
        }
          goto _L5
        stringbuilder.append("0");
        i1++;
          goto _L6
    }
}
